package com.whfc.ms.api.emp.service.impl;

import com.whfc.common.result.ListData;
import com.whfc.common.result.PageData;
import com.whfc.emp.dto.AppEmpBlackDTO;
import com.whfc.emp.dto.AppEmpDTO;
import com.whfc.emp.param.AppEmpBlackAddParam;
import com.whfc.emp.service.AppBlackService;
import com.whfc.fuum.entity.SysUser;
import com.whfc.ms.api.emp.service.MsEmpBlackService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClasssName MsEmpBlackServiceImpl
 * @Description 人员黑名单
 * @Author hw
 * @Date 2020/12/2 14:33
 * @Version 1.0
 */
@Service
public class MsEmpBlackServiceImpl implements MsEmpBlackService {

    @DubboReference(interfaceClass = AppBlackService.class, version = "1.0.0", timeout = 10 * 1000)
    private AppBlackService appBlackService;

    @Override
    public PageData<AppEmpBlackDTO> blackList(Integer deptId, Integer pageNum, Integer pageSize, String keyword) {
        return appBlackService.blackList(deptId, pageNum, pageSize, keyword);
    }

    @Override
    public void blackAdd(SysUser user, AppEmpBlackAddParam request) {
        request.setUserId(user.getId());
        request.setUserName(user.getNickname());
        appBlackService.blackAdd(request);
    }

    @Override
    public void blackDel(Integer id) {
        appBlackService.blackDel(id);
    }

    @Override
    public ListData<AppEmpDTO> blackEmpList(Integer deptId) {
        List<AppEmpDTO> list = appBlackService.getEmpList(deptId);
        return new ListData<>(list);
    }

    @Override
    public void blackDelList(List<Integer> ids) {
        appBlackService.blackDelList(ids);
    }
}
